package com.example.controller.sys;
import com.example.service.IContactsService;
import com.example.vo.ResultVo;
import com.example.vo.respvo.ContactsGroupVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 通讯录Controller控制类
 *
 * @author wsl
 */
@RestController
@RequestMapping("/sys/contacts")
@Api(tags = "通讯录")
public class ContactsController {

    @Autowired
    private IContactsService contactsService;

    @GetMapping("/organization")
    @ApiOperation(value = "获取组织通讯录")
    public ResultVo getOrganizationContacts() {
        return contactsService.getOrganizationContacts();
    }

    @GetMapping("/user-group")
    @ApiModelProperty(value = "用户组通讯录")
    public ResultVo getUserGroupContacts(Integer empId){
        return contactsService.getUserGroupContacts(empId);
    }

    @GetMapping("/export")
    @ApiOperation(value = "导出组织通讯录")
    public void exportOrganizationContacts(HttpServletResponse response){
        contactsService.exportOrganizationContacts(response);
    }
}
